package com.sun.dream.fish.util;

import io.micrometer.common.util.StringUtils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Description:
 * Created By ljl on 2023/12/18.
 */
public class CommonUtil {

    private static final String PHONE_NUMBER_REGEX = "^[+]?[0-9]{10,13}$";

    public static boolean isValidPhoneNumber(String phoneNumber) {
        if (StringUtils.isBlank(phoneNumber)) {
            return true;
        }
        Pattern pattern = Pattern.compile(PHONE_NUMBER_REGEX);
        Matcher matcher = pattern.matcher(phoneNumber);
        return matcher.matches();
    }
}
